import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CmModalComponent } from './modal.component';
import { CmModalInstanceComponent, getDynamicModal } from './modal-instance.component';
import { CmModalService } from "./modal.service";


@NgModule({
  imports: [
    BrowserModule
  ],
  declarations: [
    CmModalComponent,
    CmModalInstanceComponent
  ],
  providers: [
    CmModalService
  ],
  exports: [
    CmModalComponent,
    CmModalInstanceComponent
  ]
})
export class ModalModule { }


const getDynamicModalModule = (templateUrl, moduleId?) => {

  @NgModule({
    imports: [
      BrowserModule
    ],
    declarations: [
      getDynamicModal(templateUrl, moduleId)
    ]
  })
  class DynamicModalModule { }

  return DynamicModalModule;
}

export { getDynamicModalModule }